package cn.gary.oaserver.params;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author: 邓必宏
 * @title:
 * @Demo:
 * @DateTime: 2024/3/15
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("响应对象")
public class Result {
    @ApiModelProperty("响应码")
    private Integer code;
    @ApiModelProperty("响应信息")
    private String message;
    @ApiModelProperty("响应数据")
    private Object data;



    public static Result success(int code,String message,Object data){
        return new Result(code, message, data);
    }
    public static Result success(String message,Object data){

        return new Result( 200,message, data);
    }
    public static Result success(String message){
        return new Result( 200,message,null);
    }

    public static Result error(int code,String message,Object data){
        return new Result(code, message, data);
    }
    public static Result error(String message,Object data){

        return new Result( 500,message, data);
    }
    public static Result error(String message){
        return new Result( 500,message,null);
    }
}
